package com.mk.admin.controller;

import com.mk.admin.log.WriteLog;
import com.mk.admin.model.ResultDto;
import com.mk.admin.model.vo.PatientGuidanceBatchVo;
import com.mk.admin.model.vo.PatientGuidanceVo;
import com.mk.admin.service.PatientGuidanceService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/a/adm/patientGuidance")
@Api(tags = "就诊指引")
public class PatientGuidanceController {
    @Autowired
    private PatientGuidanceService patientGuidanceService;

    @PostMapping("/select")
    public ResultDto select(@RequestBody PatientGuidanceVo vo) {
        return patientGuidanceService.select(vo);
    }

    @PostMapping("/add")
    public ResultDto add(@RequestBody PatientGuidanceVo vo) {
        return patientGuidanceService.add(vo);
    }

    @PostMapping("/addBatch")
    @ApiOperation(value = "批量生成就诊指引", notes = "挂号成功后自动生成就诊指引，按照默认模板生成多条指引数据，以后每做一次直接修改后面的指引数据即可")
    public ResultDto addBatch(@RequestBody PatientGuidanceBatchVo vo) {
        return patientGuidanceService.addBatch(vo);
    }

    @PostMapping("/update")
    public ResultDto update(@RequestBody PatientGuidanceVo vo) {
        return patientGuidanceService.update(vo);
    }

    @PostMapping("/delete")
    public ResultDto delete(@RequestBody PatientGuidanceVo vo) {
        return patientGuidanceService.delete(vo.getId());
    }

    @WriteLog("批量菜单删除")
    @PostMapping("/deleteBatchIds")
    public ResultDto deleteBatchIds(@RequestBody List<PatientGuidanceVo> list) {
        return patientGuidanceService.deleteBatchIds(list);
    }

    @PostMapping("/status")
    public ResultDto status(@RequestBody PatientGuidanceVo vo) {
        return patientGuidanceService.status(vo.getId());
    }


}
